package com.zzy.chapter3.deprecated.observe;

import com.zzy.chapter3.deprecated.state.DeprecatedAbstractOrderState;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class DeprecatedPayObserve extends DeprecatedAbstractObserve {

    @PostConstruct
    public void init() {
        DeprecatedAbstractOrderState.addObserve(this);
    }

    @Override
    public void orderStateHandle(String orderId, String orderState) {
        if(!"ORDER_WAIT_SEND".equals(orderState)) {
            return;
        }
        System.out.println("监听到：订单支付成功。通过命令模式做后续处理");
    }
}
